package com.zyh.system.dao.impl;

import com.zyh.system.dao.UserDao;
import com.zyh.system.domain.User;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @Author zyh
 * @Date 2024/8/1 18:33
 * @Description UserDao实现类
 */

public class UserDaoImpl implements UserDao {
    public static final Map<String,String> MAP=new HashMap<>();
    static {
        MAP.put("zyh","123");
    }

    /**
     * 登录功能
     * @param map   map集合
     * @param user  User对象
     * @return
     */
    @Override
    public boolean login(Map<String, String> map, User user) {
        boolean flag=false;
        Set<String> strings = map.keySet();
        for (String key : strings) {
            String value = map.get(key);
            if (key.equals(user.getName())&&value.equals(user.getPassword())){
                flag=true;
                break;
            }
        }
        if (!flag){
            return false;
        }
        return true;
    }
}
